import request from '@/config/axios'

// 资源购买记录 VO
export interface ArticleBuyHistoryVO {
  id: number // 编号
  articleId: number // 文章ID
  articleName: string // 文章标题
  dir: string // 资源目录
  payStatus: boolean // 是否已支付：[0:未支付 1:已经支付过]
  payOrderId: number // 支付订单编号
  payChannelCode: string // 支付成功的支付渠道
  payTime: Date // 订单支付时间
}

// 资源购买记录 API
export const ArticleBuyHistoryApi = {
  // 查询资源购买记录分页
  getArticleBuyHistoryPage: async (params: any) => {
    return await request.get({ url: `/system/article-buy-history/page`, params })
  },

  // 查询资源购买记录详情
  getArticleBuyHistory: async (id: number) => {
    return await request.get({ url: `/system/article-buy-history/get?id=` + id })
  },

  // 新增资源购买记录
  createArticleBuyHistory: async (data: ArticleBuyHistoryVO) => {
    return await request.post({ url: `/system/article-buy-history/create`, data })
  },

  // 修改资源购买记录
  updateArticleBuyHistory: async (data: ArticleBuyHistoryVO) => {
    return await request.put({ url: `/system/article-buy-history/update`, data })
  },

  // 删除资源购买记录
  deleteArticleBuyHistory: async (id: number) => {
    return await request.delete({ url: `/system/article-buy-history/delete?id=` + id })
  },

  // 导出资源购买记录 Excel
  exportArticleBuyHistory: async (params) => {
    return await request.download({ url: `/system/article-buy-history/export-excel`, params })
  }
}
